import requests

def get_solved_problems(username, min_rating=1500):
    url = f"https://codeforces.com/api/user.status?handle={username}&from=1&count=100000"
    response = requests.get(url)
    data = response.json()

    if data['status'] != 'OK':
        print("API 请求失败，检查用户名是否正确。")
        return

    submissions = data['result']
    solved = set()

    for sub in submissions:
        if sub.get("verdict") == "OK":
            problem = sub["problem"]
            rating = problem.get("rating")
            if rating is not None and rating >= min_rating:
                # 唯一标识题目，用 contestId 和 index
                problem_id = (problem['contestId'], problem['index'])
                solved.add(problem_id)

    print(f"\n{username} 通过的题目，rating ≥ {min_rating}：\n")
    for contest_id, index in sorted(solved):
        link = f"https://codeforces.com/contest/{contest_id}/problem/{index}"
        print(link)

# 示例调用
#get_solved_problems("wslqm", min_rating=2000)
get_solved_problems("PancakeKing", min_rating=1800)